package com.spring.controller;

import com.spring.pojo.Author;
import com.spring.pojo.Book;
import com.spring.pojo.User;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AdviceController {
    @GetMapping("user")
    public User user(Model model){
        User user=(User) model.getAttribute("info");
        return user;
    }

    @GetMapping("/book")
    public String fiction(@ModelAttribute("b") Book book,@ModelAttribute("a") Author author){
        return book.toString()+">>>>"+author.toString();
    }

}
